package com.googlecode.aleverr.yafotkiclient.api;

import org.w3c.dom.Node;

import java.util.List;

public class PhotoCollection extends AbstractCollection<Photo> {

    private PhotoCollection() {
    }

    @Override
    protected Photo processEntry(Node entryNode) {
        return Photo.fromEntryNode(entryNode);
    }

    public static PhotoCollection fromUrl(String address, String accessToken) {
        PhotoCollection result = new PhotoCollection();
        result.processUrl(address, accessToken);
        return result;
    }

    public static void main(String[] args) {
        PhotoCollection photoCollection = PhotoCollection.fromUrl(
                "http://api-fotki.yandex.ru/api/users/aleverr/album/306373/photos/",
                "594250735702441f8adf35172aea8809");
        List<Photo> photos = photoCollection.getEntries();
        for (Photo photo : photos) {
            System.out.println(photo);
        }
    }
}
